{extend name="template"}

{block name="body"}
<style>
    body{width:100%;height:100%;background: url(__ROOT__/static/index/img/reg_bg_x.jpg) repeat-x 0 top #fff;}
</style>
<div class="gas-register gas-index layui-fluid" style="margin:0 auto;width:900px;">

    <div style="margin:0 auto;width: inherit;">
        <div class="header padding-bottom-20" style="margin-top:30px;position:relative;">
            <a href="/"><img style="height:60px;" src="__ROOT__/static/index/img/logo1.png"></a>
            <a href="/" style="position:absolute;right:0;bottom:30px;font-size:14px;color:#fff;vertical-align: bottom;">返回首页</a>
        </div>
        <style>
            .login-table{margin:40px auto 0;}
            .login-table tr{height:42px;}
            .login-table tr th{font-size:14px;color:#666;text-align: right;}
            .login-table tr td{text-align: center;text-align: center;}
            .login-table input[type=text],.login-table input[type=password]{
                width: 200px!important;
                height: 14px!important;
                padding: 6px 20px 7px 4px!important;
            }
            .login-table input[type=checkbox]{
                vertical-align: -2px;
                margin-right:5px;
            }

            .login-table button {
                margin-right: 12px !important;
                padding: 7px 18px !important;
                text-decoration: none !important;
                font-size: 14px !important;
                background-color:#ff931d;
                border:0;
                color:white;
            }
        </style>
        <div style="margin-top:10px;padding:20px 0;width:100%;background-color: #fff;">

            <ul class="layui-tab-title">
                <li class="" style="min-width: 20px;"></li>
                <li class="layui-this">用户注册</li>
            </ul>
            <div class="layui-tab-content" style="height:300px;padding-top:0;">
                <div class="layui-tab-item layui-show" style="width:60%;height:300px;float:left;border-right:1px solid #ccc;">
                    <form name="register" method="post" action="">
                        <table class="login-table">
                            <tr>
                                <th>用户名：</th>
                                <td><input maxlength="16" type="text" name="username" /></td>
                            </tr>
                            <tr>
                                <th>密码：</th>
                                <td><input maxlength="16" type="password" name="password" /></td>
                            </tr>
                            <tr>
                                <th>手机号码：</th>
                                <td><input maxlength="11" type="text" name="contact_phone" /></td>
                            </tr>
                            <tr>
                                <th>单位名称：</th>
                                <td><input maxlength="32" type="text" name="company_name" /></td>
                            </tr>
                            <tr>
                                <th></th>
                                <td style="text-align: left;">
                                    <a href="/register/agreement.html">《燃气协会网站使用协议》 </a>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <input type="hidden" name="loginStatus" value="1" />
                                    <button name="submit" type="button">马上注册</button>
                                </td>
                            </tr>
                        </table>
                    </form>
                </div>
                <div class="layui-tab-item layui-show" style="float:left;">
                    <div style="font-size:14px;width:320px;text-align:center;margin-top:100px;">
                        已有帐号，<a href="/login.html">马上登录>></a>
                    </div>
                </div>
            </div>

        </div>
    </div>

</div>

{/block}

{block name='style'}
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<script>if (location.href.indexOf('#') > -1) location.replace(location.href.split('#')[0])</script>
<link rel="stylesheet" href="__ROOT__/static/index/index.css">
{/block}

{block name='script'}
<script src="__ROOT__/static/index/index.js"></script>
<script>
    $("button[name=submit]").click(function () {
        var data = {
            "username": $("input[name=username]").val(),
            "password": hex_md5($("input[name=password]").val()),
            "contact_phone": $("input[name=contact_phone]").val(),
            "company_name": $("input[name=company_name]").val(),
        };
        $.post("/register.html", data, function(res) {
            if(res.code==0){
                layer.msg(res.info);
            }else{
                layer.msg(res.info);
                setTimeout(function () {
                    location.href="/login.html";
                }, 3000);
            }

        },"json");
    });
</script>
{/block}
